package com.wc.alorithm_blue_bridge._DFS.买瓜;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/3/11 19:39
 * @description
 * https://www.lanqiao.cn/courses/46292/learning/?id=3441390&compatibility=false
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 35;
    static int[] a = new int[N];
    static long[] s = new long[N];
    static int n, m, res = N;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt() << 1;
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt() << 1;
        Arrays.sort(a, 1, n + 1);
        for (int i = 1, j = n; i < j; i++, j--) {
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
        for (int i = n; i >= 1; i--) s[i] = s[i + 1] + a[i];
        dfs(1, 0, 0);
        out.println(res == N ? -1 : res);
        out.flush();
    }

    static void dfs(int u, long sum, int st) {
        // 超出了
        if (u > n + 1) return;
        // 总和过了
        if (sum > m) return;
        // 加上后面不够了
        if (sum + s[u] < m) return;
        // 恰好相等
        if (sum == m)  {
            res = Math.min(res, st);
            return;
        }

        dfs(u + 1, sum + a[u], st);
        dfs(u + 1, sum, st);
        dfs(u + 1, sum + a[u] / 2, st + 1);
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

